//
//  ThreadOCViewController.m
//  JKRunloopTest
//
//  Created by 王冲 on 2018/10/21.
//  Copyright © 2018年 JK科技有限公司. All rights reserved.
//

#import "ThreadOCViewController.h"

#import "JKOCPermenantThread.h"
@interface ThreadOCViewController ()

@property (strong, nonatomic) JKOCPermenantThread *thread;

@end

@implementation ThreadOCViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self threadCode];
    
}

#pragma mark 2：控制线程生命周期（线程保活）
-(void)threadCode{
    
    self.thread = [[JKOCPermenantThread alloc] init];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [self.thread executeTask:^{
        NSLog(@"执行任务 - %@", [NSThread currentThread]);
    }];
}

- (void)dealloc
{
    NSLog(@"%s", __func__);
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
